package com.sky.web.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ExitServlet extends HttpServlet {



	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //退出登录：
	    //1.清楚登录的信息
		 request.getSession().invalidate();
		//2.退回到登录页面
		 //window.location.href这个表示当前窗口页面跳转替换
		 //如果是frameset中使用window.location.href页面表示在框架内部跳转
		 
		 //window.top.location.href在frameset中表示的是在框架之间跳转
		response.getWriter().write("<script type='text/javascript'>"
				+ "window.top.location.href='login.jsp'</script>");
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}


}
